{% extends 'front/user_base.html' %}
{% block css %}
<style>
    .post-list .infosbox{
        border-bottom: 1px solid #8d7e7e;
        margin-bottom: 2rem;
    }
    .post-list .infosbox .post-sub-header{
        display: flex;
        justify-content: space-between;
        margin-top: 0.8rem;
    }
</style>
{% endblock %}
{% block content %}
    <div class="tabs-warp">
        <div class="tabs">
            <ul>
                <li class="">
                    <a href="/user/center/?page=1" class="">
                        <span class="icon is-small">
                            <i aria-hidden="true" class="iconfont icon-topic"></i>
                        </span>
                        <span>俱乐部</span>
                    </a>
                </li>
                <li class="active">
                    <a href="/user/post/?page=1" class="">
                        <span class="icon is-small">
                            <i aria-hidden="true" class="iconfont icon-article"></i>
                        </span>
                        <span>分享</span>
                    </a>
                </li>
                <li class="">
                    <a href="/access/record/?page=1" class="">
                        <span class="icon is-small">
                            <i aria-hidden="true" class="iconfont icon-topic"></i>
                        </span>
                        <span>访客记录</span>
                    </a>
                </li>
            </ul>
        </div>
        <div>
            <div class="post-list">
            {% for post in post_list %}
                <div class="infosbox">
                    <div class="newsview">
                      <h3 class="news_title">{{post.title}}</h3>
                      <div class="bloginfo">
                        <ul class="post-sub-header">
                          <li class="timer">时间：{{ moment(post.create_time.date()).format('LL') }}</li>
                          <li class="tags">
                                <a href="#" target="_blank">
                                  发布在：{% for club in user_club_list %}{% if club.id == post.club_id %}{{ club.name }}{% endif %}{% endfor %}
                                </a> &nbsp;
                          </li>
                          <li class="action">
                              <a style="color:#0a9f39" href="{{ url_for('main.update_post', post_id=post.id) }}">编辑</a>
                          </li>
                        </ul>
                      </div>
                      <div class="news_con" style="line-height: 1.8rem;padding-bottom: 2rem;margin-top: 1.5rem;">
                          {{ post.content | safe}}
                      </div>
                    </div>
                </div>
            {% endfor %}
        {#    {{ render_page(pagination, endpoint, club_id)}}#}
            {%  if pagination.pages > 1 %}
            <ul class="pagelist">
                <li{% if not pagination.has_prev %} class="disabled"{% endif %}>
                    <a href="{% if pagination.has_prev %}{{ url_for(endpoint, club_id=club_id,
                        page = pagination.page - 1) }}{% else %}#{% endif %}">
                        &laquo;
                    </a>
                </li>
                {% for p in pagination.iter_pages() %}
                    {% if p %}
                        {% if p == pagination.page %}
                        <li class="active">
                            <a href="{{ url_for(endpoint, club_id=club_id, page = p) }}">{{ p }}</a>
                        </li>
                        {% else %}
                        <li>
                            <a href="{{ url_for(endpoint, club_id=club_id, page = p) }}">{{ p }}</a>
                        </li>
                        {% endif %}
                    {% else %}
                    <li class="disabled"><a href="#">&hellip;</a></li>
                    {% endif %}
                {% endfor %}
                <li{% if not pagination.has_next %} class="disabled"{% endif %}>
                    <a href="{% if pagination.has_next %}{{ url_for(endpoint, club_id=club_id,
                        page = pagination.page + 1) }}{% else %}#{% endif %}">
                        &raquo;
                    </a>
                </li>
            </ul>
    {% endif %}
  </div>

        </div>
    </div>
{% endblock %}